from peewee import CharField, DateTimeField, IntegerField

from application.db import get_database_connection
from application.db.mysql_db.base_mysql_model import BaseMysqlModel


class CnArticleUnitPlatformIdRelation(BaseMysqlModel):
    """中文文献库机构单位名称对应各平台单位标识关系表"""
    unit_id = CharField(max_length=32, index=True)  # 机构单位ID，表cn_article_unit_dict标识
    platform_id = CharField(max_length=255, index=True)  # 第三方平台的单位ID
    platform_code = CharField(max_length=255)  # 平台代码，取值["yiigle"(中华医学数据库), "cnki"(知网), ...]

    class Meta:
        table_name = 'cn_article_unit_platform_id_relation'
        database = get_database_connection('default')  # 使用默认数据库


if __name__ == '__main__':
    # 示例用法
    data = CnArticleUnitPlatformIdRelation.select().dicts()
    for i in data:
        print(i)